<%@ page import="cn.edu.hbcit.text1.Account" %>
<%@ page import="cn.edu.hbcit.text1.StudentDb" %><%--
  Created by IntelliJ IDEA.
  User: 11507
  Date: 2019/6/20
  Time: 16:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>状态查询</title>
</head>
<body>
<div class="container">
    <%@include file="template/header.jsp" %>
    <%
        String id = request.getParameter("id");     // 接收id
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        int myage = Integer.parseInt(age);
        String sex = request.getParameter("sex");
        String mypalce = request.getParameter("mypalce");
        String major = request.getParameter("major");
        String myclass = request.getParameter("myclass");
        String nation = request.getParameter("nation");
        ServletContext context = (ServletContext) request.getServletContext();
        String acountNumber = (String) context.getAttribute("acountNumber");
        boolean tempFlag = StudentDb.delStu(id, acountNumber);
        if (tempFlag) {
            out.print("<div class=\"alert alert-info\">\n" +
                    "  <strong>成功!</strong>  删除工作已经成功。\n" +
                    "</div>");
        } else {
            out.print("<div class=\"alert alert-danger\">\n" +
                    "  <strong>失败!</strong> 数据删除失败，系统故障 \n" +
                    "</div>");
        }
        boolean tempFlag2 = StudentDb.addStu(id, name, myage, sex, mypalce, major, myclass, nation, acountNumber);
        if (tempFlag2) {
            out.print("<div class=\"alert alert-info\">\n" +
                    "  <strong>成功!</strong>  数据已经插入成功。\n" +
                    "</div>");
        } else {
            out.print("<div class=\"alert alert-danger\">\n" +
                    "  <strong>失败!</strong> 数据插入失败，系统故障 \n" +
                    "</div>");
        }

        if (tempFlag && tempFlag2) {
            out.print("<div class=\"alert alert-success\">\n" +
                    "  <strong>成功!</strong>  信息已经修改成功。\n" +
                    "</div>");
        } else {
            out.print("<div class=\"alert alert-danger\">\n" +
                    "  <strong>失败!</strong> 信息修改失败，系统故障 \n" +
                    "</div>");
        }
    %>

    <%

    %>

    <a href="student_main.jsp">
        <button type="button" class="btn btn-outline-secondary">返回系统</button>
    </a>


    <%@include file="template/footer.jsp" %>
</div>
<%@include file="template/link.jsp" %>
<%@include file="template/autoClick.jsp" %>
</body>
</html>
